extends CharacterBody2D

# 这三个变量只是用来传递数据的, 实际的数据来自Weapon
var direction = Vector2.ZERO	# 方向
var speed = 0					# 速度
var power = 0					# 伤害

@onready var animation = $AnimatedSprite2D

func _ready():
	self.rotation = direction.angle()
	if power < 2:
		animation.play("min")
	elif power < 4:
		animation.play("medium")
	else:
		animation.play("max")

func _physics_process(_delta):
	# 控制子弹的飞行速度和方向
	if direction == null:
		direction = Vector2(1, 0)
		
	velocity = direction * speed
	move_and_slide()
